function! api#ultisnips#init() abort
    if !exists("g:did_plugin_ultisnips")
        try
            packadd ultisnips
        catch /.*/
            echoerr v:exception
        endtry
    endif
    if exists("g:did_plugin_ultisnips") && g:did_plugin_ultisnips
        let g:UltiSnipsExpandTrigger = "<tab>"
        let g:UltiSnipsListSnippets = "<c-tab>"
        let g:UltiSnipsJumpForwardTrigger = "<c-j>"
        let g:UltiSnipsJumpBackwardTrigger = "<c-k>"
        let g:snippet_map = get(g:, "snippet_map", { "name" : "+snippet" })
        let g:snippet_map.A = ["UltiSnipsAddFiletypes", "add-filetype"]
        let g:snippet_map.a = ["UltiSnipsEdit", "edit-snippet"]
        let g:snippet_map.e = [":call UltiSnips#ExpandSnippet()", "expand"]
        " space_keymap
        let g:space_keymap = get(g:, "space_keymap", { "name": "+space"})
        let g:space_keymap.s = g:snippet_map
    endif
endfunction
